<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 有属性PI,两个方法，计算最大值和最小值
        let myMath  = {
                PI: 3.1415926,
                max: function() {
                    // arguments 伪数组对象
                    let max = arguments[0];
                    for (let i = 1; i < arguments.length; i++) {
                        if (max < arguments[i]) {
                            max = arguments[i];
                        }
                    }
                    if(typeof max != Number){
                        max = Number(max);
                    }
                    if(arguments.length == 0){
                        max = -Infinity;
                    }
                    return max;
                },
                min: function(){
                    let min = arguments[0];
                    for (let i = 1; i < arguments.length; i++) {
                        if (min > arguments[i]) {
                            min = arguments[i];
                        }
                    }
                    if(typeof min != Number){
                        min = Number(min);
                    }
                    if(arguments.length == 0){
                        min = -Infinity;
                    }
                    return min;
                }
            };
            console.log(myMath.max());
            console.log(myMath.max('12',11));
    </script>
</body>
</html>